@import "../../css/units.css";

.sprite-selector {
    flex-grow: 1;
    position: relative; 
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    margin-right: calc($space / 2);
    background-color: #f9f9f9;
    border-top-right-radius: $space;
    border-top-left-radius: $space;
    border-color: #dbdbdb;
    border-width: 1px;
    border-style: solid;
    border-bottom: 0;
}

/* In prep for renaming sprite-selector-item to sprite */
.sprite {
    /* 
        Our goal is to fit sprites evenly in a row without leftover space.
        Flexbox's `space between` property gets us close, but doesn't flow 
        well when the # of items per row > 1 and less than the max per row.

        Solving by explicitly calc'ing the width of each sprite. Setting 
        `border-box` simplifies things, because content, padding and 
        border-width all are included in the width, leaving us only to subtract 
        the left + right margins.

        @todo: make room for the scrollbar
    */
    box-sizing: border-box;
    width: calc((100% / $sprites-per-row ) - $space);
    min-width: 4rem;
    min-height: 4rem; /* @todo: calc height same as width */
    margin: calc($space / 2); 
}


.scroll-wrapper {
    /*
       Sets the sprite-selector items as a scrollable pane

        @todo: Safari: pane doesn't stretch to fill height;
        @todo: Adding `position: relative` still doesn't fix Safari scrolling pane, and 
              also introduces a new bug in Chrome when vertically resizing window down, 
              then back up, introduces white space in the outside the page container. 
    */
    height: calc(100% - $sprite-info-height); 
    overflow-y: scroll;
}

.items-wrapper {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;

    padding-top: calc($space / 2);
    padding-left: calc($space / 2);
    padding-right: calc($space / 2);
    padding-bottom: $space; 
}

.add-button {
    font-size: 0.55rem;
    font-weight: bold;
    position: absolute;
    bottom: 0.75rem;
    right: 1rem;
}
